{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "obj\n"
     ]
    }
   ],
   "source": [
    "class A:\n",
    "    name = \"A\"\n",
    "    def __init__(self):\n",
    "        self.name = \"obj\"\n",
    "        \n",
    "a = A()\n",
    "print(a.name)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "## 多继承：C3算法"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(<class '__main__.A'>, <class '__main__.B'>, <class '__main__.D'>, <class '__main__.C'>, <class '__main__.E'>, <class 'object'>)\n"
     ]
    }
   ],
   "source": [
    "## 新式类\n",
    "class D:\n",
    "    pass\n",
    "\n",
    "class E:\n",
    "    pass\n",
    "\n",
    "class C(E):\n",
    "    pass\n",
    "\n",
    "class B(D):\n",
    "    pass\n",
    "\n",
    "class A(B, C):\n",
    "    pass\n",
    "\n",
    "print(A.__mro__)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
